Thread: [Error] no match for 'operator<' in '(& st

  1. #1
    Registered User
    Join Date
    Feb 2015
    Posts
    74

    [Error] no match for 'operator<' in '(& st

    Good evening!
    What a mistake that then?




    ...Я чомусь її сам не бачу
    ... For some reason I do not see it myself

    Code:
    class Integer2
    {
    private:
        int value;
    public:
        Integer2(int i): value(i) 
        {}
    
    
        Integer2& operator=(const Integer2& right) {
            //проверка на самоприсваивание
            if (this == &right) {
                return *this;
            }
            value = right.value;
            return *this;
        }
        
        void Print(    )
        {
            std::cout<<"value  "<< value<std::endl;
        }
        
    };
    
    
    
    
    int main(){
        Integer2 ob1(10),ob2(35);
        ob1 Print(); ob2 Print();
        ob1= ob2 ;
        ob1 Print; ob2 Print;
        
    return 0;    
    }
    84 40 C:\T\Perevantazh.cpp [Error] no match for 'operator<' in '(& std:perator<< <std::char_traits<char> >((* & std::cout), ((const char*)"value ")))->std::basic_ostream<_CharT, _Traits>:perator<< <char, std:





    I do not know, maybe I was misled, or do not see that something simple, but I do not understand what the compiler says. I do not understand the error, and not think at all.





    Oh, it is written with a point. I'm sure all misled. As I write this? Wow.
    Now I must correct myself.


    void Print( &nbsp
    {
    std::cout<<"value "<< value<std::endl;
    }


    It is this feature really, still has an error which I can not fix myself.


    Oh, wow! Everything has now happened all fixed, that is all very well now. All right!


    I wish to all, many winter holidays, which are already very close, celebrate well, a lot of joy and fun that would be very, good and different! Cheerful mood and happy holidays!
    Last edited by Дмитро; 12-16-2015 at 11:52 AM.

  2. #2
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Code:
           std::cout<<"value  "<< value < std::endl;
    Should be

    Code:
          std::cout<<"value  "<< value << std::endl;
    Also, I note another error in main. When calling a member on an instance of a class you do

    Code:
     instance_name.member();

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error : no match for 'operator<<' in 'std::cin 1935374429'
    By funnydarkvador in forum C++ Programming
    Replies: 3
    Last Post: 03-12-2013, 05:06 PM
  2. Fix basic error: no match for 'operator!=' in 'i != ...
    By aeolusaether in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2010, 12:27 AM
  3. Replies: 9
    Last Post: 03-30-2009, 06:37 PM
  4. new to C++ : Error: no match for `operator` ....
    By MasterACE14 in forum C++ Programming
    Replies: 13
    Last Post: 05-23-2008, 01:56 AM
  5. Replies: 3
    Last Post: 06-05-2006, 10:18 AM